package com.adxon.data;

import javax.servlet.http.HttpServletRequest;

import com.adxon.MsgException;
import com.adxon.servlet.ServletBase;

public class Mark extends Item{
	public final static int KN=6;

	public Mark(){
		kn=KN;
		rt=10;
	}
	/*@Override
	protected String allocateId()throws MsgException{
		String r=ph+"/"+rf;
		try{	// check existing
			ent=entity(bsk,r);
			id=updateLong("id");
		}catch(MsgException e){
			super.allocateId();
		}
		return r;
	}*/
	@Override
	protected void commitExt()throws MsgException{
		super.commitExt();
		if(tg==null)
			for(int i=100;i>0;i--)try{
				Item f=getRef();
				commitTags(f.tg);
				break;
			}catch(MsgException e){
				System.out.println("Mark: "+i);
				ServletBase.delay(10);	// TODO:
			}
	}
	@Override
	public String getDescription(){
		return ds==null?getRef().ds:ds;
	}
	@Override
	public String getExtra(){
		return getRef().xt;
	}
	@Override
	public String getInfoId()throws MsgException{
		return getRef().toString();
	}
	@Override
	public Item getOwnerEx()throws MsgException{
		return getRef().getOwner();
	}
	@Override
	public long getOwnerIdEx(){
		return getRef().getOwnerId();
	}
	@Override
	public String getUrl(){
		return getRef().getUrl();
	}
	@Override
	public void getPost(HttpServletRequest req){
		getAll(req);
		req.setAttribute("Page","postlink.jsp");
	}
	@Override
	public String getTags(){
		return getRef().tg;
	}
	@Override
	public String getText(){
		return getRef().tx;
	}
	/*@Override
	public void setMark(long owner){
		if(owner==0)
			mkr=null;
		else if(owner==ow)
			mkr=this;
		else try{
			mkr=new Mark().update(rf,owner);
		}catch(MsgException e){
			mkr=null;
		}
	}
	@Override
	protected void star(){
		try{
			sta=sto==ow?this:(Kindee)new Mark().update(sto+"/"+rf);
		}catch(MsgException e){
			sta=null;
		}
	}*/
}